<template>
  <div class="login">
    <input type="text" placeholder="请输入用户名" v-model="username"/>
    <button type="button" @click="loginBtn">登录</button>
  </div>
</template>

<script>
export default {
  name: 'Login',
  data() {
    return {
      username: ''
    }
  },
  created() {
  },
  mounted() {
  },
  computed: {},
  methods: {
    loginBtn() {
      if (this.username.trim() === '') {
        alert('请输入用户名')
        return
      }
      localStorage.setItem('username', this.username.trim())
      this.$router.push('/home')
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
